From 9b35f57c680ff08326a529aee13eae0e58b97ab1 Mon Sep 17 00:00:00 2001 From: "kaf24@freefall.cl.cam.ac.uk" Date: Thu, 16 Sep 2004 13:11:34 +0000 Subject: [PATCH] bitkeeper revision 1.1159.1.158 (41499106LOJstE56FhydVjOBF9ioOQ) Improve configuration of virtual device drivers in XenLinux. --- linux-2.6.8.1-xen-sparse/arch/xen/Kconfig | 67 +++++++++++++++++-- .../arch/xen/configs/xen0_defconfig | 5 ++ .../arch/xen/configs/xenU_defconfig | 5 ++ .../arch/xen/i386/mm/ioremap.c | 5 -- linux-2.6.8.1-xen-sparse/drivers/xen/Makefile | 8 +-- .../drivers/xen/netfront/netfront.c | 23 ++++--- .../include/asm-xen/asm-i386/pgalloc.h | 2 - 7 files changed, 92 insertions(+), 23 deletions(-) diff --git a/linux-2.6.8.1-xen-sparse/arch/xen/Kconfig b/linux-2.6.8.1-xen-sparse/arch/xen/Kconfig index 2bbe0229b4..a7e3994e10 100644 --- a/linux-2.6.8.1-xen-sparse/arch/xen/Kconfig +++ b/linux-2.6.8.1-xen-sparse/arch/xen/Kconfig @@ -31,9 +31,68 @@ config XEN_PRIVILEGED_GUEST Support for privileged operation (domain 0) config XEN_PHYSDEV_ACCESS - bool "Device-driver domain (physical device access)" + bool "Physical device access" + default y if XEN_PRIVILEGED_GUEST + default n if !XEN_PRIVILEGED_GUEST help - Device-driver domain (physical device access) + Assume access is available to physical hardware devices + (e.g., hard drives, network cards). This allows you to configure + such devices and also includes some low-level support that is + otherwise not compiled into the kernel. + +config XEN_BLKDEV_BACKEND + bool "Block-device backend driver" + default y if XEN_PHYSDEV_ACCESS + default n if !XEN_PHYSDEV_ACCESS + help + The block-device backend driver allows the kernel to export its + block devices to other guests via a high-performance shared-memory + interface. + +config XEN_NETDEV_BACKEND + bool "Network-device backend driver" + default y if XEN_PHYSDEV_ACCESS + default n if !XEN_PHYSDEV_ACCESS + help + The network-device backend driver allows the kernel to export its + network devices to other guests via a high-performance shared-memory + interface. + +config XEN_BLKDEV_FRONTEND + bool "Block-device frontend driver" + default y + help + The block-device frontend driver allows the kernel to access block + devices mounted within another guest OS. Unless you are building a + dedicated device-driver domain, or your master control domain + (domain 0), then you almost certainly want to say Y here. + +config XEN_NETDEV_FRONTEND + bool "Network-device frontend driver" + default y + help + The network-device frontend driver allows the kernel to access + network interfaces within another guest OS. Unless you are building a + dedicated device-driver domain, or your master control domain + (domain 0), then you almost certainly want to say Y here. + +if XEN_NETDEV_FRONTEND +config XEN_NETDEV_FRONTEND_PIPELINED_TRANSMITTER + bool "Pipelined transmitter (DANGEROUS)" + default n + help + The driver will assume that the backend is pipelining packets for + transmission: whenever packets are pending in the remote backend, + the driver will not send asynchronous notifications when it queues + additional packets for transmission. + If the backend is a dumb domain, such as a transparent Ethernet + bridge with no local IP interface, it is safe to say Y here to get + slightly lower network overhead. + If the backend has a local IP interface; or may be doing smart things + like reassembling packets to perform firewall filtering; or if you + are unsure; or if you experience network hangs when this option is + enabled; then you must say N here. +endif config XEN_WRITABLE_PAGETABLES bool "Use writable pagetables" @@ -49,8 +108,8 @@ config FOREIGN_PAGES config PAGESIZED_SKBS bool - default y if XEN_PHYSDEV_ACCESS - default n if !XEN_PHYSDEV_ACCESS + default y if XEN_NETDEV_BACKEND + default n if !XEN_NETDEV_BACKEND #config VT # bool diff --git a/linux-2.6.8.1-xen-sparse/arch/xen/configs/xen0_defconfig b/linux-2.6.8.1-xen-sparse/arch/xen/configs/xen0_defconfig index 75fac7e487..a118d649cc 100644 --- a/linux-2.6.8.1-xen-sparse/arch/xen/configs/xen0_defconfig +++ b/linux-2.6.8.1-xen-sparse/arch/xen/configs/xen0_defconfig @@ -10,6 +10,11 @@ CONFIG_NO_IDLE_HZ=y # CONFIG_XEN_PRIVILEGED_GUEST=y CONFIG_XEN_PHYSDEV_ACCESS=y +CONFIG_XEN_BLKDEV_BACKEND=y +CONFIG_XEN_NETDEV_BACKEND=y +CONFIG_XEN_BLKDEV_FRONTEND=y +CONFIG_XEN_NETDEV_FRONTEND=y +# CONFIG_XEN_NETDEV_FRONTEND_PIPELINED_TRANSMITTER is not set CONFIG_XEN_WRITABLE_PAGETABLES=y CONFIG_FOREIGN_PAGES=y CONFIG_PAGESIZED_SKBS=y diff --git a/linux-2.6.8.1-xen-sparse/arch/xen/configs/xenU_defconfig b/linux-2.6.8.1-xen-sparse/arch/xen/configs/xenU_defconfig index 8d0d9fc5a3..a3efc64d58 100644 --- a/linux-2.6.8.1-xen-sparse/arch/xen/configs/xenU_defconfig +++ b/linux-2.6.8.1-xen-sparse/arch/xen/configs/xenU_defconfig @@ -10,6 +10,11 @@ CONFIG_NO_IDLE_HZ=y # # CONFIG_XEN_PRIVILEGED_GUEST is not set # CONFIG_XEN_PHYSDEV_ACCESS is not set +# CONFIG_XEN_BLKDEV_BACKEND is not set +# CONFIG_XEN_NETDEV_BACKEND is not set +CONFIG_XEN_BLKDEV_FRONTEND=y +CONFIG_XEN_NETDEV_FRONTEND=y +# CONFIG_XEN_NETDEV_FRONTEND_PIPELINED_TRANSMITTER is not set CONFIG_XEN_WRITABLE_PAGETABLES=y CONFIG_FOREIGN_PAGES=y # CONFIG_PAGESIZED_SKBS is not set diff --git a/linux-2.6.8.1-xen-sparse/arch/xen/i386/mm/ioremap.c b/linux-2.6.8.1-xen-sparse/arch/xen/i386/mm/ioremap.c index 1efdacd8c2..8a12a5c93c 100644 --- a/linux-2.6.8.1-xen-sparse/arch/xen/i386/mm/ioremap.c +++ b/linux-2.6.8.1-xen-sparse/arch/xen/i386/mm/ioremap.c @@ -337,8 +337,6 @@ void __init bt_iounmap(void *addr, unsigned long size) #endif /* CONFIG_XEN_PHYSDEV_ACCESS */ -#if defined(CONFIG_XEN_PRIVILEGED_GUEST) - /* These hacky macros avoid phys->machine translations. */ #define __direct_pte(x) ((pte_t) { (x) } ) #define __direct_mk_pte(page_nr,pgprot) \ @@ -481,6 +479,3 @@ int direct_remap_area_pages(struct mm_struct *mm, return 0; } - - -#endif /* CONFIG_XEN_PRIVILEGED_GUEST */ diff --git a/linux-2.6.8.1-xen-sparse/drivers/xen/Makefile b/linux-2.6.8.1-xen-sparse/drivers/xen/Makefile index f002a93334..82b5559bc9 100644 --- a/linux-2.6.8.1-xen-sparse/drivers/xen/Makefile +++ b/linux-2.6.8.1-xen-sparse/drivers/xen/Makefile @@ -1,11 +1,11 @@ -obj-y += blkfront/ obj-y += console/ obj-y += evtchn/ -obj-y += netfront/ obj-y += privcmd/ -obj-$(CONFIG_XEN_PHYSDEV_ACCESS) += blkback/ -obj-$(CONFIG_XEN_PHYSDEV_ACCESS) += netback/ +obj-$(CONFIG_XEN_BLKDEV_BACKEND) += blkback/ +obj-$(CONFIG_XEN_NETDEV_BACKEND) += netback/ +obj-$(CONFIG_XEN_BLKDEV_FRONTEND) += blkfront/ +obj-$(CONFIG_XEN_NETDEV_FRONTEND) += netfront/ diff --git a/linux-2.6.8.1-xen-sparse/drivers/xen/netfront/netfront.c b/linux-2.6.8.1-xen-sparse/drivers/xen/netfront/netfront.c index 166b70897c..683dd616da 100644 --- a/linux-2.6.8.1-xen-sparse/drivers/xen/netfront/netfront.c +++ b/linux-2.6.8.1-xen-sparse/drivers/xen/netfront/netfront.c @@ -40,6 +40,19 @@ #define __GFP_NOWARN 0 #endif +/* + * If the backend driver is pipelining transmit requests then we can be very + * aggressive in avoiding new-packet notifications -- only need to send a + * notification if there are no outstanding unreceived responses. + * If the backend may be buffering our transmit buffers for any reason then we + * are rather more conservative. + */ +#ifdef CONFIG_XEN_NETDEV_FRONTEND_PIPELINED_TRANSMITTER +#define TX_TEST_IDX resp_prod /* aggressive: any outstanding responses? */ +#else +#define TX_TEST_IDX req_cons /* conservative: not seen all our requests? */ +#endif + static void network_tx_buf_gc(struct net_device *dev); static void network_alloc_rx_buffers(struct net_device *dev); @@ -408,15 +421,9 @@ static int network_start_xmit(struct sk_buff *skb, struct net_device *dev) np->stats.tx_bytes += skb->len; np->stats.tx_packets++; - /* Only notify Xen if there are no outstanding responses. */ - /* - * KAF (16/9/04): Checking outstanding responses is unsafe, as pending work - * may be dependent on packets not yet seen by the backend (e.g., he may - * have a partially-assembled fragmented IP packet). For now, the check is - * more conservative -- has the backend seen all previous requests? - */ + /* Only notify Xen if we really have to. */ mb(); - if ( np->tx->req_cons/*resp_prod*/ == i ) + if ( np->tx->TX_TEST_IDX == i ) notify_via_evtchn(np->evtchn); return 0; diff --git a/linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/pgalloc.h b/linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/pgalloc.h index 559df16eac..77d16e3e72 100644 --- a/linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/pgalloc.h +++ b/linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/pgalloc.h @@ -53,7 +53,6 @@ extern void pte_free(struct page *pte); #define check_pgt_cache() do { } while (0) -#ifdef CONFIG_XEN_PRIVILEGED_GUEST int direct_remap_area_pages(struct mm_struct *mm, unsigned long address, unsigned long machine_addr, @@ -64,6 +63,5 @@ int __direct_remap_area_pages(struct mm_struct *mm, unsigned long address, unsigned long size, mmu_update_t *v); -#endif /* CONFIG_XEN_PRIVILEGED_GUEST */ #endif /* _I386_PGALLOC_H */ -- 2.30.2